<%@page import="com.swm.julie.rest.crud.twitt.TwittDocFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Update the twitt</title>
<script type="text/javascript">
function checkField(form)
{
	if(form.newposturl == null)
	{
		alert("Please enter the twit's URL");
		return false;
	}
	
	if(form.newcontents == null)
	{
		alert("Please enter the contents!!");
		return false;
	}
	
	if(form.newpostdate == null)
	{
		var currTime = new Date();
		form.postdate.value = "" + currTime.getFullYear() + "" + currTime.getMonth() + "" + currTime.getDate() + "" + currTime.getDay() + "" + currTime.getHours() + "" + currTime.getMinutes() + "" + currTime.getSeconds();
	}
	
	return true;
}
</script>
<%
TwittDocFormat twitt = (TwittDocFormat) request.getAttribute("twitt");
%>
</head>
<body>
<h1>Update the twitt</h1>
<ul>
<form method="post" onsubmit="return checkField(this);" action="/update.do">
<li>id : <%= twitt.getId() %></li>
<li>postdate : <input type="text" name="newpostdate" value="<%= twitt.getPostdate() %>"></li>
<li>contents : <input type="text" name="newcontents" value="<%= twitt.getContents() %>"></li>
<li>linkInfo : <input type="text" name="newlinkInfo" value="<%= twitt.getLinkInfo() %>"></li>
<li>posturl : <input type="text" name="newposturl" value="<%= twitt.getPostUrl() %>"></li>
</ul>
<input type="hidden" name="id" value="<%= twitt.getId() %>">
<input type="hidden" name="oldpostdate" value="<%= twitt.getPostdate() %>">
<input type="hidden" name="oldcontents" value="<%= twitt.getContents() %>">
<input type="hidden" name="oldlinkInfo" value="<%= twitt.getLinkInfo() %>">
<input type="hidden" name="oldwposturl" value="<%= twitt.getPostUrl() %>">
<input type="submit" value="update" >
</form>
<input type="button" value="home" onclick="location.href='/index.html'">
</body>
</html>